package com.zmn.oms.common.enums;

import com.zmn.consts.DictModel;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 类描述: 改派申请【求助状态】枚举类
 *
 * @author: 刘翟
 * @since: 2022/08/08 10:00
 */
@AllArgsConstructor
@Getter
public enum RedistributeHelpStatusEnum {
	PROCESSING_HELP(1, "求助中"),
	HELP_FAILED(2, "求助失败"),
	HELP_SUCCESS(3, "求助成功"),
	NONE_HELP(4, "无需求助"),
	;

	private Integer code;
	private String desc;


	/**
	 * 改派求助状态列表
	 *
	 * @return
	 */
	public static List<DictModel> getRedistributeHelpStatusList() {
		List<DictModel> items = new ArrayList<>(4);
		items.add(new DictModel(1, "求助中"));
		items.add(new DictModel(2, "求助失败"));
		items.add(new DictModel(3, "求助成功"));
		items.add(new DictModel(4, "无需求助"));
		return items;
	}

	/**
	 * 根据【求助状态】查询名称
	 *
	 * @param status
	 * @return
	 */
	public static String getNameByType(int status) {
		for (RedistributeHelpStatusEnum redistributeHelpStatusEnum : RedistributeHelpStatusEnum.values()) {
			if (redistributeHelpStatusEnum.getCode() == status) {
				return redistributeHelpStatusEnum.getDesc();
			}
		}
		return "";
	}
}
